package org.gruposp2p.proyectokarma.gwt.client.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import java.util.List;

import org.gruposp2p.proyectokarma.gwt.client.domain.Peer;

public class LoginEvent extends GwtEvent {
	
	public enum EventType { LOGIN, LOGOUT }
	
	//TODO: probar con PeerChanged extends 'OpenidDNIEvent'
    private static final GwtEvent.Type TYPE = new GwtEvent.Type();

    public Peer peer;
    public EventType eventType;

    public static GwtEvent.Type getType() { return TYPE;}

    @Override
    public Type getAssociatedType() { return TYPE;}

    @Override
    protected void dispatch(EventHandler handler) {
    	((LoginEvent.Handler)handler).onLoginEvent(this);
    }

    public LoginEvent (EventType eventType) {
        this.eventType = eventType;
    }
    
    public void setPeer (Peer peer) {
    	this.peer = peer;
    }
    
    /**
     * Implemented by handlers of this type of event.
     */
    public interface Handler extends EventHandler {
    	void onLoginEvent(LoginEvent event);
    }

}